﻿Imports Microsoft.Xna.Framework

Namespace ResourceManager

    Public Enum AnchorPoint As Integer
        LeftUpper
        LeftMiddle
        LeftLower
        RightUpper
        RightMiddle
        RightLower
        Center
    End Enum

    Public Class Texture2DObject
        Inherits ResourceObjectBase

        Public Property Texutre() As Graphics.Texture2D

        Public Sub New()
            MyBase.New()
        End Sub

        Public Sub New(ByVal name As String, ByVal fileName As String, ByVal texture As Graphics.Texture2D)
            MyBase.New(name, fileName)
            Me.Texutre = texture
        End Sub

        ''' <summary>
        ''' Get some special reference point.
        ''' </summary>
        ''' <param name="a"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GetAnchorPoint(ByVal a As AnchorPoint) As Point
            Select Case a
                Case AnchorPoint.Center
                    Return New Point(Me.Texutre.Height \ 2, Me.Texutre.Width \ 2)
                Case AnchorPoint.LeftLower
                    Return New Point(0, Me.Texutre.Width)
                Case AnchorPoint.LeftMiddle
                    Return New Point(0, Me.Texutre.Width \ 2)
                Case AnchorPoint.LeftUpper
                    Return New Point(0, 0)
                Case AnchorPoint.RightLower
                    Return New Point(Me.Texutre.Height, Me.Texutre.Width)
                Case AnchorPoint.RightMiddle
                    Return New Point(Me.Texutre.Height, Me.Texutre.Width \ 2)
                Case AnchorPoint.RightUpper
                    Return New Point(Me.Texutre.Height, 0)
            End Select
        End Function

    End Class

End Namespace